-
Notifications
You must be signed in to change notification settings - Fork 37
Use gradients and subduing in MultiSeriesBarChart #311
Conversation
| @@ -1,17 +1,13 @@ | |||
| import React, {useMemo} from 'react'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same component that lived in BarChart/components. I've just moved it up, since all Bars now use the same API
| @@ -1,135 +1,95 @@ | |||
| import React from 'react'; | |||
| import {mount} from '@shopify/react-testing'; | |||
| import {scaleBand} from 'd3-scale'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as mentioned above, just moving the Bar from BarChart/components up
|
|
||
| <SquareColorPreview color={color} /> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this since now SquareColorPreView can handle both solid colors and gradients
| const handleFocus = () => { | ||
| onFocus(barGroupIndex); | ||
| }; | ||
| <mask id={maskId}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same strategy used on the BarChart: masking a tag that contains the gradients
| <StackMarkup | ||
| data={data} | ||
| xScale={xScale} | ||
| onFocus={onFocus} | ||
| ariaHidden | ||
| activeBarId={activeBarId} | ||
| accessibilityData={accessibilityData} | ||
| activeBarGroup={activeBarGroup} | ||
| yScale={yScale} | ||
| groupIndex={groupIndex} | ||
| /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I was simply reusing the markup with a <use/> tag, but I had to convert it to a react component so I can aria-hide the duplicate and prevent them from being focusable
src/components/MultiSeriesBarChart/components/BarGroup/BarGroup.tsx
Outdated
Show resolved
Hide resolved
src/components/MultiSeriesBarChart/components/BarGroup/BarGroup.tsx
Outdated
Show resolved
Hide resolved
| import {SquareColorPreview, SquareColorPreviewProps} from '../../../components'; | ||
|
|
||
| export default { | ||
| title: 'SquareColorPreview', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move towards putting the components/subcomponents into their own storybook group.
| title: 'SquareColorPreview', | |
| title: 'Components/SquareColorPreview', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a top level component though. What would be the benefit of it being separated from the other stories in its own folder? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking that the charts would be in one group and all of the other components that make up the charts such as tooltips, legends, etc could be in another group.
|
Something I noticed when testing the 04-30-15-54-qcjaj-1j1pl.mp4 |
src/components/MultiSeriesBarChart/components/StackedBarGroup/StackedBarGroup.tsx
Outdated
Show resolved
Hide resolved
src/components/MultiSeriesBarChart/components/StackedBarGroup/StackedBarGroup.tsx
Outdated
Show resolved
Hide resolved
src/components/MultiSeriesBarChart/components/StackedBarGroup/StackedBarGroup.tsx
Outdated
Show resolved
Hide resolved
abaf030 to
b92fffe
Compare
|
@pbojinov I don't think that is a problem. The black square that appears around the element tries to highlight visually the element currently selected. If the value is 0 the element is indeed invisible, so it uses the chart as a fallback. |
src/components/MultiSeriesBarChart/stories/MultiSeriesBarChart.stories.tsx
Outdated
Show resolved
Hide resolved
...onents/MultiSeriesBarChart/components/StackedBarGroup/components/StackMarkup/StackMarkup.tsx
Outdated
Show resolved
Hide resolved
4e5cc07 to
3e2e5d5
Compare
src/components/MultiSeriesBarChart/components/StackedBarGroup/StackedBarGroup.tsx
Show resolved
Hide resolved
carysmills
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code and 🎩 looks good to me
Left a suggestion about the types in StackedBarGroup
Can you please make sure to update MultiSeriesBarChart.md with the changes to the props, as well as the changelog?
3e2e5d5 to
e46d3d9
Compare
e674bd0 to
ad338b6
Compare
What problem is this PR solving?
Solves: https://github.com/Shopify/core-issues/issues/23793
components/Bar<MultiSeriesBarChart/>. Even though it works, we should revisit this chart later to check what would be the expected gradient behaviour and introduce animations:Reviewers’ 🎩 instructions
Before merging
Check your changes on a variety of browsers and devices.
Update the Changelog.
Update relevant documentation.